package common

import "time"

// ParseTime 解析时间字符串
func ParseTime(timeStr string) time.Time {
	if timeStr == "" {
		return time.Time{}
	}

	// 尝试不同的时间格式
	formats := []string{
		"2006-01-02 15:04:05",
		"2006-01-02T15:04:05",
		"2006-01-02",
	}

	for _, format := range formats {
		if t, err := time.Parse(format, timeStr); err == nil {
			return t
		}
	}

	return time.Time{}
}
